package phase1_testCase;

import java.util.Vector;

import phase1.IO;
import phase1.Block;
import junit.framework.TestCase;

public class IO_testCase extends TestCase{
	private IO process;
	
	public void setUp(){}
	
	public void tearDown(){}
	
	public void testInput1(){
		process = new IO("src/block.txt");
		Block result;
		result = process.input();
		assertEquals('a', result.getChar(0));
	}
	
	public void testInput2(){
		process = new IO("src/block.txt");
		Block result;
		result = process.input();
		assertEquals('b', result.getChar(1));
	}
	
	public void testInput3(){
		process = new IO("src/block.txt");
		Block result;
		result = process.input();
		assertEquals('k', result.getChar(2));
	}
	
	public void testInput4(){
		process = new IO("src/block2.txt");
		Block result;
		result = process.input();
		assertEquals('c', result.getChar(1));
	}
	
	public void testInput5(){
		process = new IO("src/block2.txt");
		Block result;
		result = process.input();
		assertEquals(' ', result.getChar(2));
	}
	
	public void testInput6(){
		process = new IO("src/block3.txt");
		Block result;
		result = process.input();
		assertEquals("java.lang.ArrayIndexOutOfBoundsException", null, result);
	}
	
	public void testNextBlock(){
		process = new IO("src/block.txt");
		Vector<Block> resultVector;
		Block result;
		Block temp;
		temp = process.input();
		resultVector = temp.getNextBlock();
		result = resultVector.get(0);
		assertEquals('s', result.getChar(0));
	}
	
	public void testOutput(){
		process = new IO();
		Vector<String> resultVector = new Vector<String>();
		resultVector.add("aba");
		resultVector.add("abb");
		resultVector.add("abc");
		process.output(resultVector);
	}
}
